<template>
  <div class="not-found-container">
    <div class="stars"></div>
    <div class="twinkling"></div>
    <div class="clouds"></div>

    <div class="content">
      <h1>404</h1>
      <h2>页面迷失在太空中</h2>
      <p>您访问的页面不存在或已被移除</p>

      <div class="astronaut">
        <img src="C:\Users\25286\Vue3\log\img_26.webp" alt="astronaut">
      </div>

      <button @click="goHome" class="home-btn">返回地球</button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()

const goHome = () => {
  router.push('/')
}
</script>

<style scoped>
.not-found-container {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
  color: white;
  text-align: center;
  font-family: 'Arial', sans-serif;
}

.content {
  position: relative;
  z-index: 2;
  padding-top: 10%;
}

h1 {
  font-size: 10rem;
  margin: 0;
  text-shadow: 0 0 20px #4facfe;
  animation: glow 2s ease-in-out infinite alternate;
}

h2 {
  font-size: 2rem;
  margin: 0.5rem 0;
}

p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.astronaut {
  width: 200px;
  height: 200px;
  margin: 2rem auto;
  animation: float 6s ease-in-out infinite;
}

.astronaut img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-btn {
  padding: 12px 30px;
  background: #4facfe;
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.home-btn:hover {
  background: #00a1ff;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* 星空背景效果 */
.stars, .twinkling, .clouds {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.stars {
  background: #000 ;
  z-index: 0;
}

.twinkling {
  background: transparent ;
  z-index: 1;
  animation: twinkle 200s linear infinite;
}

.clouds {
  background: transparent ;
  z-index: 2;
  opacity: 0.4;
  animation: clouds 200s linear infinite;
}

/* 动画效果 */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

@keyframes glow {
  from { text-shadow: 0 0 10px #4facfe; }
  to { text-shadow: 0 0 20px #00a1ff, 0 0 30px #4facfe; }
}

@keyframes twinkle {
  from { background-position: 0 0; }
  to { background-position: -10000px 5000px; }
}

@keyframes clouds {
  from { background-position: 0 0; }
  to { background-position: 10000px 0; }
}
</style>